package cn.wangjie.spark.store.es

import org.apache.spark.api.java.JavaSparkContext
import org.apache.spark.api.java.JavaRDD
import org.apache.spark.SparkConf
import org.apache.spark.sql.SparkSession
import org.elasticsearch.spark.rdd.api.java.JavaEsSpark;

object Test2 {
  def main(args: Array[String]): Unit = {
    val conf = new SparkConf().setAppName("app1").setMaster("local[2]")
    conf.set("es.index.auto.create", "true"); //在spark中自动创建es中的索引
    conf.set("es.nodes", "localhost"); //设置在spark中连接es的url和端口
    conf.set("es.port", "9200");
    conf.set("es.nodes.wan.only", "true");

    val spark = SparkSession.builder().config(conf).getOrCreate()
  }
}
